<!--
嵌入组件(上传文件框)
参数
- iFiles (ArrayList<IFile>)
- id (String)
- maxCount (int:1)
- height (int:5) 高度
- var 变量名 <input name>
<div th:include="/admin/_widgets/upload-box::upload-box" th:with="iFiles=${all},id='Upload1',var=imagesId"></div>
-->
<div th:fragment="upload-box"
     xmlns:th="http://www.thymeleaf.org">
    <!--/*@thymesVar id="id" type="java.lang.String"*/-->
    <div th:id="${id}" class="container-fluid upload-wrapper">
        <!--/*@thymesVar id="var" type="java.lang.String"*/-->
        <input type="hidden" th:name="${var}">
        <div class="center-block">
            <div class="row">
                <div class="col-md-12">
                    <!--/*@thymesVar id="height" type="java.lang.Integer"*/-->
                    <div class="upload-area" th:style="'height:'+(45*(${height}?:5))+'px;'">
                        <!--/*@thymesVar id="iFiles" type="java.util.ArrayList<in.hocg.web.modules.system.domain.IFile"*/-->
                        <p class="text-sub text-center"
                           th:styleappend="${iFiles==null || iFiles.isEmpty()}?'':'display:none'">请选择需要上传的文件</p>
                        <div class="upload-progress"
                             th:if="${iFiles != null}"
                             th:classappend="${iFile.id}"
                             th:each="iFile,i : ${iFiles}"
                             th:attr="data-fid=${iFile.id}">
                            <div class="progress-info">
                                <a href="javascript:;;" class="operating remove-upload"
                                   th:attr="data-id=${iFile.id}">
                                    <i class="glyphicon glyphicon-trash"></i>
                                </a>
                                <span class="file-info">
                                    <span class="file-name"
                                          th:title="${iFile.id}"
                                          th:text="${iFile.uploadName}">file.name</span>
                                    <span class="file-size"
                                          th:text="${@iText.formatBytes(iFile.size)}">file.size</span>
                                </span>
                                <span class="upload-status">100%</span>
                            </div>
                            <div class="progress-bg success" style="width: 100%;"></div>
                        </div>

                    </div>
                    <div>
                        <ul class="upload-tip">
                            <li>不能上传超过 500M 的文件</li>
                        </ul>
                        <div class="upload-btn">
                            选择文件
                        </div>
                    </div>
                </div>
                <!--<div class="col-md-4">-->
                <!--参数设置-->
                <!--</div>-->
            </div>
        </div>
    </div>
    <script th:inline="javascript">
        $(function () {
            new UploadBox({
                id: '#' + [[${id}]],
                maxCount: [[${maxCount?:1}]],
                server: '/admin/system/file/upload',
                token: $('meta[name="_csrf"]').attr('content'),
                header: $('meta[name="_csrf_header"]').attr('content'),
                count: [[${iFiles?.size()?:0}]],
                input: 'input[name="' + [[${var}]] + '"'
            });
        });
    </script>
</div>